﻿#pragma once


#include <QtWebEngineWidgets/QtWebEngineWidgets>

#define TR QString::fromLocal8Bit

class AMUrlRequestInterceptor : public QWebEngineUrlRequestInterceptor
{
    Q_OBJECT
public:
    AMUrlRequestInterceptor(QObject* p = nullptr);
    ~AMUrlRequestInterceptor();

    virtual void interceptRequest(QWebEngineUrlRequestInfo& info);

    
};

class AMWebEnginePage : public QWebEnginePage
{
    Q_OBJECT

public:
    AMWebEnginePage(QObject*parent);
    ~AMWebEnginePage();

signals:
    void sgnDownloadFileFinished(QWebEngineDownloadItem* download);
public slots:
    void sltDownloadRequested(QWebEngineDownloadItem* download);
    void sltDownloadStateChanged();

    void sltCookieAdded(const QNetworkCookie& cookie);
protected:
	virtual QStringList chooseFiles(FileSelectionMode mode, const QStringList& oldFiles, const QStringList& acceptedMimeTypes);
    virtual bool certificateError(const QWebEngineCertificateError& certificateError);
};
